<div class="inc wb">
	<div class="inc_top">{$page_title}</div>
	<div class="inc_main">
		<div class="sub_nav">
			<span><a href="{url x="shop" r="uc_collect#index"}">{$LANG.UC_COLLECT}</a></span>
			<span><a href="{url x="shop" r="uc_collect#store"}">{$LANG.UC_STORE_FAV}</a></span>
			<span class="act"><a href="{url x="shop" r="uc_collect#menu"}">{$LANG.UC_MENU_FAV}</a></span>
		</div>
		<div class="fav_search_box clearfix mr10 ml10">
			<span class="f_l mt5">您共收藏了<span class="co">{$count}</span>个菜单</span>
			<span class="f_r">
				<form name="uc_collect_menu_form" id="uc_collect_menu_form" action="{url x="index" r="uc_collect#menu"}" method="post">
				<b>按餐厅名搜索</b>
				<input id="menuSchIpt" name="keyword" class="input w200" type="text" value="">
				<span class="grebtn grebtn_s mr5" style="line-height:1.4">
                    <i class="green_line" style="width:50px"></i>
                    <strong class="grebtn_in">
                    	<a href="javascript:void(0)">搜索</a></strong>
                    <i class="green_line" style="width:50px"></i>
                </span>
				</form>
			</span>
		</div>
		<div class="uc-table">
			{foreach from=$list item=item}
			<div class="fav_menu_item clearfix pl10 pr10 pb10 mb10 bbd">
				<div class="pic f_l mr10">
					<a href="{url x="store" r="view" p="id=$item.sid"}" title="{$item.location_name}"><img src="{function name="get_spec_image" v=$item.preview w=140 h=140 g=1}"  width=95 height=95  class="lazy" alt="{$store.name}" /></a>
				</div>
				<div class="info f_l lh24">
					<div class="clearfix">
						<strong class="menuNameTxt f14 f_l">{$item.name}</strong>
						<input type="text" name="menuName" class="menuNameipt f-input hide f_l" value="{$item.name}" />
						<a href="javascript:void(0);" data-id="{$item.id}" class="f_l eidt_fav_menu ml10 g9">修改</a>
					</div>
					<div class="location">
						<a href="{url x="store" r="view" p="id=$item.sid"}" title="{$item.location_name}" class=" bc">{$item.location_name}</a>
					</div>
					<div class="clearfix menu fs">
						{foreach from=$item.menu item=m}
						{$m.name}{function name="format_price" v=$m.price}{if $m.nums gt 1} X {$m.nums}{/if}&nbsp;&nbsp;
						{/foreach}
					</div>
				</div>
				<div class="opt f_r">
					<span class="icons i009 mr5"></span><a href="{url x="store" r="pmenu" p="sid=$item.sid&mid=$item.id"}" class="g9" target="_blank">打印菜单</a><br>
					<span class="icons i010 mr5"></span><a href="{url x="store" r="smenu" p="sid=$item.sid&mid=$item.id"}" class="g9" target="_blank">发送菜单到手机</a><br>
					<span class="icons i011 mr5"></span><a href="javascript:void(0);" class="del_fav_menu g9" data-id="{$item.id}">删除菜单</a><br>
				</div>
			</div>
			{/foreach}	
			<div class="blank"></div>
			<div class="pages">{$pages}</div>
		</div><!--end uc-table-->
	</div>
	<div class="inc_foot"></div>
</div>

<script type="text/javascript">
	jQuery(function(){
		$("a.eidt_fav_menu").bind("click",function(){
			if($(this).parent().find(".menuNameipt").hasClass("hide")){
				$(this).parent().find(".menuNameTxt").addClass("hide");
				$(this).parent().find(".menuNameipt").removeClass("hide");
				$(this).html("保存");
			}
			else{
				var obj=$(this);
				obj.html("保存中...");
				var query = new Object();
				query.id =  obj.attr("data-id");
				query.val = $.trim(obj.parent().find(".menuNameipt").val());
				if(query.val!=""&&parseInt(query.id)>0)
				{
					$.ajax({
						url:APP_ROOT + '/index.php?ctl=uc_collect&act=updatemenu',
						data:query,
						type:'post',
						dataType:'json',
						cache:false,
						success:function(result){
							if(result.status==1)
							{
								obj.parent().find(".menuNameTxt").html(query.val);
							}
							else{
								$.showErr(result.message);
							}
						}
					});
				}
				obj.parent().find(".menuNameTxt").removeClass("hide");
				obj.parent().find(".menuNameipt").addClass("hide");
				obj.html("修改");
			}
		});
		$(".del_fav_menu").bind("click",function(){
			if(confirm("确定删除该收菜的菜单？")){
				var obj=$(this);
				var query = new Object();
				query.id =  obj.attr("data-id");
				$.ajax({
					url:APP_ROOT + '/index.php?ctl=uc_collect&act=del_menu',
					data:query,
					type:'post',
					dataType:'json',
					cache:false,
					success:function(result){
						if(result.status==1)
						{
							obj.parent().parent().remove();
						}
						else{
							$.showErr(result.message);
						}
					}
				});
			}
		});
		$("#uc_collect_menu_form a").click(function(){
			$("#uc_collect_menu_form").submit();
		});
	});
</script>